<template xmlns:v-action="">
    <a-card :bordered="false">
        <div class="table-page-search-wrapper">
            <a-form layout="inline" ref="queryPmsGoodsForm" :form="queryPmsGoodsForm">
                <a-row :gutter="48">
                    <a-col :md="8" :sm="24">
                        <a-form-item label="平台编码">
                            <a-input v-decorator="['goodsNo',{ rules: [{ required: false}] }]"/>
                        </a-form-item>
                    </a-col>
                  <a-col :md="8" :sm="24">
                    <a-form-item label="货号">
                      <a-input v-decorator="['goodsSn',{ rules: [{ required: false}] }]"/>
                    </a-form-item>
                  </a-col>
                  <template v-if="advanced">
                    <a-col :md="8" :sm="24">
                      <a-form-item label="上架状态">
                        <a-input v-decorator="['publishStatus',{ rules: [{ required: false}] }]"/>
                      </a-form-item>
                    </a-col>
                    <a-col :md="8" :sm="24">
                        <a-form-item label="店铺名称">
                            <a-input v-decorator="['storeName',{ rules: [{ required: false}] }]"/>
                        </a-form-item>
                    </a-col>
                    <a-col :md="8" :sm="24">
                        <a-form-item label="区域名称">
                            <a-input v-decorator="['areaName',{ rules: [{ required: false}] }]"/>
                        </a-form-item>
                    </a-col>
                    <a-col :md="8" :sm="24">
                        <a-form-item label="品牌名称">
                            <a-input v-decorator="['brandName',{ rules: [{ required: false}] }]"/>
                        </a-form-item>
                    </a-col>
                    <a-col :md="8" :sm="24">
                        <a-form-item label="商品分类名称">
                            <a-input v-decorator="['categoryName',{ rules: [{ required: false}] }]"/>
                        </a-form-item>
                    </a-col>
                    <a-col :md="8" :sm="24">
                        <a-form-item label="商品名称">
                            <a-input v-decorator="['goodsName',{ rules: [{ required: false}] }]"/>
                        </a-form-item>
                    </a-col>

                    <a-col :md="8" :sm="24">
                        <a-form-item label="新品状态">
                            <a-input v-decorator="['newStatus',{ rules: [{ required: false}] }]"/>
                        </a-form-item>
                    </a-col>
                    <a-col :md="8" :sm="24">
                        <a-form-item label="审核状态">
                            <a-input v-decorator="['verifyStatus',{ rules: [{ required: false}] }]"/>
                        </a-form-item>
                    </a-col>
                    <a-col :md="8" :sm="24">
                        <a-form-item label="二手商品">
                            <a-input v-decorator="['secondHandStatus',{ rules: [{ required: false}] }]"/>
                        </a-form-item>
                    </a-col>
                    <a-col :md="8" :sm="24">
                        <a-form-item label="预告商品">
                            <a-input v-decorator="['previewStatus',{ rules: [{ required: false}] }]"/>
                        </a-form-item>
                    </a-col>
                    </template>
                    <a-col :md="!advanced && 8 || 24" :sm="24">
                    <span class="table-page-search-submitButtons" :style="advanced && { float: 'right', overflow: 'hidden' } || {} ">
                      <a-button type="primary" @click="handleSearchPmsGoods">查询</a-button>
                      <a-button style="margin-left: 8px" @click="handleSearchResetPmsGoods">重置</a-button>
                      <a @click="toggleAdvanced" style="margin-left: 8px">
                        {{ advanced ? '收起' : '展开' }}
                        <a-icon :type="advanced ? 'up' : 'down'"/>
                      </a>
                    </span>
                    </a-col>
                </a-row>
            </a-form>
        </div>

        <div class="table-operator">
            <a-button type="primary" v-action:pms_pmsGoods_add icon="plus" @click="handleAddPmsGoods">新建</a-button>
            <a-dropdown v-if="selectedRowKeys.length > 0">
                <a-menu slot="overlay">
                    <a-menu-item key="1" v-action:pms_pmsGoods_delete @click="handleBatchDeletePmsGoods"><a-icon type="delete" />删除</a-menu-item>
                    <!-- lock | unlock -->
                    <a-menu-item key="2"><a-icon type="lock" />扩展</a-menu-item>
                </a-menu>
                <a-button style="margin-left: 8px">
                    批量操作 <a-icon type="down" />
                </a-button>
            </a-dropdown>
        </div>

        <!-- 列表  -->
        <s-table
                ref="table"
                size="default"
                rowKey="goodsId"
                :columns="columns"
                :data="loadData"
                :alert="{ show: true, clear: true }"
                :scroll="{ x: 2200, y: 500 }"
                :rowSelection="{ fixed:true, selectedRowKeys: this.selectedRowKeys, onChange: this.onSelectChange }"
        >
            <template v-for="(col, index) in columns" v-if="col.scopedSlots" :slot="col.dataIndex" slot-scope="text">
                <div :key="index">
                    <template>{{ text }}</template>
                </div>
            </template>
          <template slot="avatar" slot-scope="url">
            <a-avatar slot="avatar" size="large" shape="square" :src="url"/>
          </template>
            <template slot="status" slot-scope="text">
                <div v-if="text==1">启用</div>
                <div v-if="text==0">关闭</div>
            </template>
            <span slot="action" slot-scope="text, record">
        <a @click="handleEditPmsGoods(record)">编辑</a>
        <a-divider type="vertical" />
        <a-dropdown>
          <a class="ant-dropdown-link">
            更多 <a-icon type="down" />
          </a>
          <a-menu slot="overlay">
            <a-menu-item>
              <a href="javascript:" @click="handleDetailPmsGoods(record)" >详情</a>
            </a-menu-item>
            <a-menu-item>
              <a href="javascript:" v-if="record.statusEnable==1" @click="handleDisableStatusPmsGoods(record)">关闭</a>
              <a href="javascript:" v-if="record.statusEnable==0" @click="handleDisableStatusPmsGoods(record)">启用</a>
            </a-menu-item>
            <a-menu-item>
              <a href="javascript:" @click="handleDeletePmsGoods(record)">删除</a>
            </a-menu-item>
          </a-menu>
        </a-dropdown>
      </span>
        </s-table>
        <!--   新建表单 -->
        <a-modal
                title="新建"
                :width="800"
                v-model="addModelVisible"
                :confirmLoading="addConfirmLoading"
                @ok="handleSavePmsGoods"
        >
            <a-form :form="addPmsGoodsForm">
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="ID"
                                validateStatus="success"
                                hasFeedback >
                            <a-input v-decorator="[ 'goodsId',{ rules: [{ required: false, message: '主键' }] }]" disabled="disabled"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="平台编码"
                                hasFeedback >
                            <a-input v-decorator="[ 'goodsNo',{ rules: [{ required: false, message: '平台编码' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="店铺ID"
                                hasFeedback >
                            <a-input v-decorator="[ 'storeId',{ rules: [{ required: false, message: '店铺ID' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="店铺名称"
                                hasFeedback >
                            <a-input v-decorator="[ 'storeName',{ rules: [{ required: false, message: '店铺名称' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="区域id"
                                hasFeedback >
                            <a-input v-decorator="[ 'areaId',{ rules: [{ required: false, message: '区域id' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="区域名称"
                                hasFeedback >
                            <a-input v-decorator="[ 'areaName',{ rules: [{ required: false, message: '区域名称' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="品牌ID"
                                hasFeedback >
                            <a-input v-decorator="[ 'brandId',{ rules: [{ required: false, message: '品牌ID' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="品牌名称"
                                hasFeedback >
                            <a-input v-decorator="[ 'brandName',{ rules: [{ required: false, message: '品牌名称' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="类目ID"
                                hasFeedback >
                            <a-input v-decorator="[ 'categoryId',{ rules: [{ required: false, message: '类目ID' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="商品分类名称"
                                hasFeedback >
                            <a-input v-decorator="[ 'categoryName',{ rules: [{ required: false, message: '商品分类名称' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="商品名称"
                                hasFeedback >
                            <a-input v-decorator="[ 'goodsName',{ rules: [{ required: false, message: '商品名称' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="货号"
                                hasFeedback >
                            <a-input v-decorator="[ 'goodsSn',{ rules: [{ required: false, message: '货号' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="关键字"
                                hasFeedback >
                            <a-input v-decorator="[ 'keywords',{ rules: [{ required: false, message: '关键字' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="上架状态：0->下架；1->上架"
                                hasFeedback >
                            <a-input v-decorator="[ 'publishStatus',{ rules: [{ required: false, message: '上架状态：0->下架；1->上架' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="新品状态:0->不是新品；1->新品"
                                hasFeedback >
                            <a-input v-decorator="[ 'newStatus',{ rules: [{ required: false, message: '新品状态:0->不是新品；1->新品' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="推荐状态；0->不推荐；1->推荐"
                                hasFeedback >
                            <a-input v-decorator="[ 'recommandStatus',{ rules: [{ required: false, message: '推荐状态；0->不推荐；1->推荐' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="审核状态：0->未审核；1->审核通过"
                                hasFeedback >
                            <a-input v-decorator="[ 'verifyStatus',{ rules: [{ required: false, message: '审核状态：0->未审核；1->审核通过' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="排序"
                                hasFeedback >
                            <a-input v-decorator="[ 'sortNum',{ rules: [{ required: false, message: '排序' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="销量(延迟统计)"
                                hasFeedback >
                            <a-input v-decorator="[ 'saleNum',{ rules: [{ required: false, message: '销量(延迟统计)' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="单位"
                                hasFeedback >
                            <a-input v-decorator="[ 'weightUnit',{ rules: [{ required: false, message: '单位' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="商品重量，默认为千克"
                                hasFeedback >
                            <a-input v-decorator="[ 'weight',{ rules: [{ required: false, message: '商品重量，默认为千克' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="是否二手商品：0->不是；1->是"
                                hasFeedback >
                            <a-input v-decorator="[ 'secondHandStatus',{ rules: [{ required: false, message: '是否二手商品：0->不是；1->是' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="是否为预告商品：0->不是；1->是"
                                hasFeedback >
                            <a-input v-decorator="[ 'previewStatus',{ rules: [{ required: false, message: '是否为预告商品：0->不是；1->是' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="以逗号分割的产品服务：1->无忧退货；2->快速退款；3->免费包邮"
                                hasFeedback >
                            <a-input v-decorator="[ 'serviceIds',{ rules: [{ required: false, message: '以逗号分割的产品服务：1->无忧退货；2->快速退款；3->免费包邮' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="备注"
                                hasFeedback >
                            <a-input v-decorator="[ 'note',{ rules: [{ required: false, message: '备注' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="详情描述"
                                hasFeedback >
                            <a-input v-decorator="[ 'detailDesc',{ rules: [{ required: false, message: '详情描述' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="运费模板"
                                hasFeedback >
                            <a-input v-decorator="[ 'feightTemplateId',{ rules: [{ required: false, message: '运费模板' }] }]"/>
                        </a-form-item>
                <a-divider />
            </a-form>
        </a-modal>
        <!--   编辑表单 -->
        <a-modal
                title="编辑"
                :width="800"
                v-model="editModelVisible"
                :confirmLoading="editConfirmLoading"
                @ok="handleUpdatePmsGoods"
        >
            <a-form :form="editPmsGoodsForm">
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="ID"
                        validateStatus="success"
                        hasFeedback >
                    <a-input v-decorator="[ 'goodsId',{ rules: [{ required: false, message: '主键' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="平台编码"
                        hasFeedback >
                    <a-input v-decorator="[ 'goodsNo',{ rules: [{ required: false, message: '平台编码' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="店铺ID"
                        hasFeedback >
                    <a-input v-decorator="[ 'storeId',{ rules: [{ required: false, message: '店铺ID' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="店铺名称"
                        hasFeedback >
                    <a-input v-decorator="[ 'storeName',{ rules: [{ required: false, message: '店铺名称' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="区域id"
                        hasFeedback >
                    <a-input v-decorator="[ 'areaId',{ rules: [{ required: false, message: '区域id' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="区域名称"
                        hasFeedback >
                    <a-input v-decorator="[ 'areaName',{ rules: [{ required: false, message: '区域名称' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="品牌ID"
                        hasFeedback >
                    <a-input v-decorator="[ 'brandId',{ rules: [{ required: false, message: '品牌ID' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="品牌名称"
                        hasFeedback >
                    <a-input v-decorator="[ 'brandName',{ rules: [{ required: false, message: '品牌名称' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="类目ID"
                        hasFeedback >
                    <a-input v-decorator="[ 'categoryId',{ rules: [{ required: false, message: '类目ID' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="商品分类名称"
                        hasFeedback >
                    <a-input v-decorator="[ 'categoryName',{ rules: [{ required: false, message: '商品分类名称' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="商品名称"
                        hasFeedback >
                    <a-input v-decorator="[ 'goodsName',{ rules: [{ required: false, message: '商品名称' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="货号"
                        hasFeedback >
                    <a-input v-decorator="[ 'goodsSn',{ rules: [{ required: false, message: '货号' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="关键字"
                        hasFeedback >
                    <a-input v-decorator="[ 'keywords',{ rules: [{ required: false, message: '关键字' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="上架状态：0->下架；1->上架"
                        hasFeedback >
                    <a-input v-decorator="[ 'publishStatus',{ rules: [{ required: false, message: '上架状态：0->下架；1->上架' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="新品状态:0->不是新品；1->新品"
                        hasFeedback >
                    <a-input v-decorator="[ 'newStatus',{ rules: [{ required: false, message: '新品状态:0->不是新品；1->新品' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="推荐状态；0->不推荐；1->推荐"
                        hasFeedback >
                    <a-input v-decorator="[ 'recommandStatus',{ rules: [{ required: false, message: '推荐状态；0->不推荐；1->推荐' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="审核状态：0->未审核；1->审核通过"
                        hasFeedback >
                    <a-input v-decorator="[ 'verifyStatus',{ rules: [{ required: false, message: '审核状态：0->未审核；1->审核通过' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="排序"
                        hasFeedback >
                    <a-input v-decorator="[ 'sortNum',{ rules: [{ required: false, message: '排序' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="销量(延迟统计)"
                        hasFeedback >
                    <a-input v-decorator="[ 'saleNum',{ rules: [{ required: false, message: '销量(延迟统计)' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="单位"
                        hasFeedback >
                    <a-input v-decorator="[ 'weightUnit',{ rules: [{ required: false, message: '单位' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="商品重量，默认为千克"
                        hasFeedback >
                    <a-input v-decorator="[ 'weight',{ rules: [{ required: false, message: '商品重量，默认为千克' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="是否二手商品：0->不是；1->是"
                        hasFeedback >
                    <a-input v-decorator="[ 'secondHandStatus',{ rules: [{ required: false, message: '是否二手商品：0->不是；1->是' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="是否为预告商品：0->不是；1->是"
                        hasFeedback >
                    <a-input v-decorator="[ 'previewStatus',{ rules: [{ required: false, message: '是否为预告商品：0->不是；1->是' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="以逗号分割的产品服务：1->无忧退货；2->快速退款；3->免费包邮"
                        hasFeedback >
                    <a-input v-decorator="[ 'serviceIds',{ rules: [{ required: false, message: '以逗号分割的产品服务：1->无忧退货；2->快速退款；3->免费包邮' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="备注"
                        hasFeedback >
                    <a-input v-decorator="[ 'note',{ rules: [{ required: false, message: '备注' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="详情描述"
                        hasFeedback >
                    <a-input v-decorator="[ 'detailDesc',{ rules: [{ required: false, message: '详情描述' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="运费模板"
                        hasFeedback >
                    <a-input v-decorator="[ 'feightTemplateId',{ rules: [{ required: false, message: '运费模板' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-divider />
            </a-form>
        </a-modal>
    </a-card>
</template>

<script>
    import { STable } from '@/components'
    import api from '@/api'
    import { deletePmsGoods, updatePmsGoods, addPmsGoods, batchDeletePmsGoods } from '@/api/pmsGoodsApi'

    export default {
        name: 'PmsGoodsList',
        data () {
        return {
            description: '',
            labelCol: {
                xs: { span: 24 },
                sm: { span: 5 }
            },
            wrapperCol: {
                xs: { span: 24 },
                sm: { span: 16 }
            },
            queryPmsGoodsForm: this.$form.createForm(this, { name: 'query_form' }),
            addModelVisible: false,
            addConfirmLoading: false,
            addPmsGoodsForm: this.$form.createForm(this, { name: 'add_form' }),
            editPmsGoodsForm: this.$form.createForm(this, { name: 'edit_form' }),
            editPmsGoodsRecord: {},
            editModelVisible: false,
            editConfirmLoading: false,
            // 高级搜索 展开/关闭
            advanced: false,
            // 查询参数
            queryParam: {
            },
            // 表头

            columns: [
              {
                title: '图片',
                dataIndex: 'picUrl',
                width: '100',
                sorter: false,
                scopedSlots: { customRender: 'avatar' },
                needTotal: false,
                fixed: 'left'
              },
              {
                title: '商品名称',
                dataIndex: 'goodsName',
                minWidth: '200',
                // width: '300',
                sorter: false,
                // scopedSlots: { customRender: '' },
                needTotal: false
              },
              {
                title: '平台编码',
                dataIndex: 'goodsNo',
                width: '100',
                sorter: false,
                // scopedSlots: { customRender: '' },
                needTotal: false
              },
              // {
              //   title: '货号',
              //   dataIndex: 'goodsSn',
              //   width: '100',
              //   sorter: false,
              //   // scopedSlots: { customRender: '' },
              //   needTotal: false
              // },
                {
                    title: '店铺',
                    dataIndex: 'storeName',
                    // width: '100',
                    sorter: false,
                    // scopedSlots: { customRender: '' },
                    needTotal: false
                },
                {
                    title: '品牌',
                    dataIndex: 'brandName',
                    // width: '100',
                    sorter: false,
                    // scopedSlots: { customRender: '' },
                    needTotal: false
                },
                {
                    title: '商品分类',
                    dataIndex: 'categoryName',
                    width: '100',
                    sorter: false,
                    // scopedSlots: { customRender: '' },
                    needTotal: false
                },
                {
                    title: '上架状态',
                    dataIndex: 'publishStatus',
                    width: '20',
                    sorter: false,
                    // scopedSlots: { customRender: '' },
                    needTotal: false
                },
                {
                    title: '审核状态',
                    dataIndex: 'verifyStatus',
                    width: '20',
                    sorter: false,
                    // scopedSlots: { customRender: '' },
                    needTotal: false
                },
                {
                    title: '销量',
                    dataIndex: 'saleNum',
                    width: '20',
                    sorter: false,
                    // scopedSlots: { customRender: '' },
                    needTotal: false
                },
                // {
                //     title: '二手商品',
                //     dataIndex: 'secondHandStatus',
                //     width: '100',
                //     sorter: false,
                //     // scopedSlots: { customRender: '' },
                //     needTotal: false
                // },
                // {
                //     title: '备注',
                //     dataIndex: 'note',
                //     // width: '100',
                //     sorter: false,
                //     // scopedSlots: { customRender: '' },
                //     needTotal: false
                // },
                {
                  table: '操作',
                  dataIndex: 'action',
                  width: '150',
                  scopedSlots: { customRender: 'action' },
                  fixed: 'right'
                }
            ],
            // 加载数据方法 必须为 Promise 对象
            loadData: parameter => {
            return this.$http.get(api.pmsGoodsUrl, {
                    params: Object.assign(parameter, this.queryParam)
                }).then(res => {
                    return res.data
                }, err => {
                this.$notification['error']({
                    message: '提示',
                    description: err.msg || '加载数据失败',
                    duration: 8
                })
                return { pageNo: 0, totalCount: 0, data: [] }
              })
            },
            selectedRowKeys: [],
            selectedRows: []
        }
        },
        components: {
            STable
        },
         methods: {
             // 搜索查询
             handleSearchPmsGoods () {
                 this.queryParam = this.queryPmsGoodsForm.getFieldsValue()
                 this.loadData = parameter => {
                     return this.$http.get(api.pmsGoodsUrl, {
                     params: Object.assign(parameter, this.queryParam)
                     }).then(res => {
                     return res.data
                     })
                 }
                 this.$refs.table.refresh()
             },
             // 搜索重置
             handleSearchResetPmsGoods () {
                 this.queryPmsGoodsForm.resetFields()
             },
             handleChangePmsGoods (value, key, column, record) {
                 record[column.dataIndex] = value
             },
             handleEditPmsGoods (record) {
                 this.editPmsGoodsRecord = Object.assign({}, record)
                 this.editModelVisible = true
                 this.$nextTick(() => {
                     let values = this.editPmsGoodsForm.getFieldsValue()
                     for(let key in values) {
                     values[key] = this.editPmsGoodsRecord[key];
                     this.editPmsGoodsForm.setFieldsValue(values)
                 }
             })
             },
             // 新增
             handleAddPmsGoods () {
                 this.addPmsGoodsRecord = {}
                 this.addModelVisible = true
                 this.addPmsGoodsForm.resetFields();
             },
             // 批量删除
             handleBatchDeletePmsGoods () {
                 // console.log('===============handleBatchDelete', this.selectedRowKeys)
                 // console.log('===============handleBatchDelete', this.selectedRowKeys[0])
                 let ids = this.selectedRowKeys
                 let params = this.selectedRowKeys
                 const that = this
                 this.$confirm({
                     title: '警告',
                     content: `真的要批量删除 ${ids.length} 个吗?`,
                     okText: '删除',
                     okType: 'danger',
                     cancelText: '取消',
                     onOk () {
                         // 在这里调用删除接口
                         return new Promise((resolve, reject) => {
                             batchDeletePmsGoods(params)
                             .then(res => {
                                 that.$refs.table.clearSelected()
                                         that.$refs.table.refresh()
                                         that.$notification['success']({
                                             message: '提示',
                                             description: res.msg || '删除成功',
                                             duration: 8
                                         })
                                 resolve()
                             }).catch((err) => {
                             reject(err)
                             that.$notification['error']({
                                 message: '提示',
                                 description: err.msg || '删除失败',
                                 duration: 8
                             })
                         })
                     }).catch(() => console.log('Oops errors!'))
                     },
                     onCancel () {
                         console.log('Cancel')
                     }
                 })
             },
             edit (row) {
                 row.editable = true
                 // row = Object.assign({}, row)
             },
             // eslint-disable-next-line
             handleDeletePmsGoods (row) {
                 const that = this
                 this.$confirm({
                     title: '警告',
                     content: `真的要删除吗?`,
                     okText: '删除',
                     okType: 'danger',
                     cancelText: '取消',
                     onOk () {
                         // 在这里调用删除接口
                         return new Promise((resolve, reject) => {
                             deletePmsGoods(row.goodsId)
                     .then(res => {
                             that.$refs.table.refresh()
                                     that.$notification['success']({
                                         message: '提示',
                                         description: res.msg || '删除成功',
                                         duration: 8
                                     })
                             resolve()
                         }).catch((err) => {
                             reject(err)
                             that.$notification['error']({
                                 message: '提示',
                                 description: err.msg || '删除失败',
                                 duration: 8
                             })
                         })
                     }).catch(() => console.log('Oops errors!'))
                     },
                     onCancel () {
                         console.log('Cancel')
                     }
                 })
             },
             handleDetailPmsGoods (row) {
                 // console.log('============ handleDetail')
             },
             handleDisableStatusPmsGoods (row) {
                 const that = this
                 let txt = row.statusEnable === 1 ? '关闭' : '启用'
                 this.$confirm({
                     title: '警告',
                     content: `真的要${txt}吗?`,
                     okText: txt,
                     okType: 'danger',
                     cancelText: '取消',
                     onOk () {
                         // 在这里调用更新接口
                         return new Promise((resolve, reject) => {
                             let params = { 'goodsId': row.goodsId,
                                 'statusEnable': row.statusEnable === 1 ? 0 : 1 }
                             updatePmsGoods(row.goodsId, params)
                     .then(res => {
                             that.$refs.table.refresh()
                                     that.$notification['success']({
                                         message: '提示',
                                         description: res.msg || '操作成功',
                                         duration: 8
                                     })
                             resolve()
                         }).catch((err) => {
                             reject(err)
                             that.$notification['error']({
                                 message: '提示',
                                 description: err.msg || '操作失败',
                                 duration: 8
                             })
                         })
                     }).catch(() => console.log('Oops errors!'))
                     },
                     onCancel () {
                         console.log('Cancel')
                     }
                 })
             },
             // 保存
             handleSavePmsGoods () {
                 // console.log('model data', this.addRecord)
                 this.addPmsGoodsForm.validateFields((err, values) => {
                     if (err) {
                         return;
                     }
                   //  console.log('Received values of addPmsGoodsForm: ', values);
                     this.addRecord = values
                     this.addConfirmLoading = true;
                     // 新增操作
                     addPmsGoods(this.editRecord)
                        .then(res => {
                         this.$notification['success']({
                             message: '提示',
                             description: res.msg || '操作成功',
                             duration: 8
                         })
                         this.addPmsGoodsForm.resetFields();
                         this.addModelVisible = false;
                         this.addConfirmLoading = false;
                         this.$refs.table.refresh()
                    })
                 .catch((err) => {
                     this.addConfirmLoading = false;
                     this.$notification['error']({
                         message: '提示',
                         description: err.msg || '操作失败',
                         duration: 8
                     })
                 });
             });
             },
             // 更新
             handleUpdatePmsGoods () {
                 console.log('model data', this.editRecord)
                 this.editPmsGoodsForm.validateFields((err, values) => {
                     if (err) {
                         return;
                     }
                     // console.log('Received values of editPmsGoodsForm: ', values);
                     this.editPmsGoodsRecord = values
                     this.editConfirmLoading = true;
                     // 更新操作
                     updatePmsGoods(this.editRecord.goodsId, this.editRecord)
                             .then(res => {
                         this.$notification['success']({
                             message: '提示',
                             description: res.msg || '操作成功',
                             duration: 8
                         })
                         this.editPmsGoodsForm.resetFields();
                         this.editModelVisible = false;
                         this.editConfirmLoading = false;
                         this.$refs.table.refresh()
                     })
                     .catch((err) => {
                             this.editConfirmLoading = false;
                         this.$notification['error']({
                             message: '提示',
                             description: err.msg || '操作失败',
                             duration: 8
                         })
                     });
                 });
             },
             onSelectChange (selectedRowKeys, selectedRows) {
                 this.selectedRowKeys = selectedRowKeys
                 this.selectedRows = selectedRows
             },
             toggleAdvanced () {
                 this.advanced = !this.advanced
             }
         }
     }
 </script>

 <style lang="less" scoped>
     .search {
         margin-bottom: 54px;
     }

     .fold {
         width: calc(100% - 216px);
         display: inline-block
     }

     .operator {
         margin-bottom: 18px;
     }

     @media screen and (max-width: 900px) {
         .fold {
             width: 100%;
         }
     }
 </style>
